// ignore_for_file: file_names, must_be_immutable, constant_identifier_names, slash_for_doc_comments, avoid_unnecessary_containers, prefer_const_constructors, unnecessary_cast, sized_box_for_whitespace, prefer_function_declarations_over_variables, overridden_fields, annotate_overrides, prefer_const_literals_to_create_immutables, unnecessary_null_comparison, deprecated_member_use
import 'package:flutter_wifi/language/Lan.dart';
import 'package:flutter_wifi/language/languageVersion/de.dart';
import 'package:flutter_wifi/language/languageVersion/en.dart';
import 'package:flutter_wifi/language/languageVersion/es.dart';
import 'package:flutter_wifi/language/languageVersion/fr.dart';
import 'package:flutter_wifi/language/languageVersion/hi.dart';
import 'package:flutter_wifi/language/languageVersion/id.dart';
import 'package:flutter_wifi/language/languageVersion/it.dart';
import 'package:flutter_wifi/language/languageVersion/ja.dart';
import 'package:flutter_wifi/language/languageVersion/kk.dart';
import 'package:flutter_wifi/language/languageVersion/ko.dart';
import 'package:flutter_wifi/language/languageVersion/pl.dart';
import 'package:flutter_wifi/language/languageVersion/pt.dart';
import 'package:flutter_wifi/language/languageVersion/ru.dart';
import 'package:flutter_wifi/language/languageVersion/th.dart';
import 'package:flutter_wifi/language/languageVersion/tr.dart';
import 'package:flutter_wifi/language/languageVersion/uk.dart';
import 'package:flutter_wifi/language/languageVersion/vi.dart';
import 'package:flutter_wifi/language/languageVersion/zhHans.dart';
import 'package:flutter_wifi/language/languageVersion/zhHant.dart';

class GlobalManager {
  // 单例公开访问点
  factory GlobalManager() => _sharedInstance();

  // 静态、同步、私有访问点
  static GlobalManager _sharedInstance() {
    return _instance;
  }

  // 静态私有成员，没有初始化
  static final GlobalManager _instance = GlobalManager._();

  // 私有构造函数
  GlobalManager._() {
    // 具体初始化代码
  }

  ///语言，默认英文
  Lan language = En();

  ///设置语言
  setLanguage(String? lan) {
    switch (lan) {
      case "de":
        language = De();
        break;
      case "en-us":
        language = En();
        break;
      case "es":
        language = Es();
        break;
      case "fr":
        language = Fr();
        break;

      case "hi":
        language = Hi();
        break;

      case "id":
        language = Id();
        break;

      case "it":
        language = It();
        break;

      case "ja":
        language = Ja();
        break;

      case "kk":
        language = Kk();
        break;

      case "ko":
        language = Ko();
        break;

      case "pl":
        language = Pl();
        break;

      case "pt":
        language = Pt();
        break;

      case "ru":
        language = Ru();
        break;

      case "th":
        language = Th();
        break;

      case "tr":
        language = Tr();
        break;

      case "uk":
        language = Uk();
        break;

      case "vi":
        language = Vi();
        break;

      case "zh-cn":
        language = ZhHans();
        break;
      case "zh-tw":
        language = ZhHant();
        break;

      default:
        language = En();
    }
  }
}
